<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <h:head>
        <title><ui:insert name="title">Default Title</ui:insert></title>
        <h:outputStylesheet library="css" name="pfcrud.css"/>
        <h:outputScript library="scripts" name="pfcrud.js"/>
    </h:head>

    <h:body>

        <p:growl id="growl" life="3000"/>

        <p:layout id="lay1" fullPage="true">
            <p:layoutUnit id="menutem" position="west" size="200">
                <center><h:graphicImage library="images" name="mundo.jpg" height="150" width="150"/></center>
                <h:form id="formNuevoTema">
                    &nbsp;&nbsp;<h:link id="nuevoTema" rendered="#{userLoginView.ingreso!='Ingresar'}" value="Nuevo Tema" outcome="/titulo/index"/>
                </h:form>
                <ui:include src="/menu.xhtml"/>
            </p:layoutUnit>

            <p:layoutUnit position="center">   
                <h:form id="formLinks">
                    <p align="right">
                        <p:commandLink rendered="#{userLoginView.ingreso=='Ingresar'}" id="ingresar" value="#{userLoginView.ingreso}" onclick="PF('dlg').show();"/> &nbsp;&nbsp;
                        <h:link rendered="#{userLoginView.ingreso!='Ingresar'}" value="#{userLoginView.ingreso}" outcome="/usuario/index"/>&nbsp;&nbsp;&nbsp;
                        <h:link rendered="#{userLoginView.ingreso=='Ingresar'}" value="Registrarse" outcome="/usuario/index"/>&nbsp;&nbsp;&nbsp;
                        <p:commandLink rendered="#{userLoginView.ingreso!='Ingresar'}" id="salir2" value="Salir" onclick="PF('dlgSalir').show();"/> &nbsp;&nbsp;
                    </p>
                </h:form> 
                <ui:insert name="body"/>                  
                <h:form id="formLog">
                    <p:dialog header="Login" widgetVar="dlg" resizable="false">
                        <h:panelGrid columns="2" cellpadding="5">
                            <h:outputLabel for="username" value="Username:" />
                            <p:inputText id="username" value="#{userLoginView.username}" required="true" label="username" />

                            <h:outputLabel for="password" value="Password:" />
                            <p:password id="password" value="#{userLoginView.password}" required="true" label="password" />

                            <f:facet name="footer">
                                <p:commandButton rendered="#{component.findComponent(':ContenidoListForm:tabW1:guardar')!= null}" id="btnLogin1" value="Login" update=":formLinks, :growl, :formNuevoTema, :ContenidoListForm:tabW1:guardar" actionListener="#{userLoginView.login}"
                                                 oncomplete="handleLoginRequest(xhr, status, args)"/>
                                <p:commandButton rendered="#{component.findComponent(':ContenidoListForm:tabW1:guardar')== null}" id="btnLogin" value="Login" update=":formLinks, :growl, :formNuevoTema" actionListener="#{userLoginView.login}"
                                                 oncomplete="handleLoginRequest(xhr, status, args)"/>
                            </f:facet>  
                        </h:panelGrid>
                    </p:dialog>
                </h:form>
                <h:form id="formSalir">
                    <p:dialog header="Salir" widgetVar="dlgSalir" resizable="false">
                        <h:panelGrid columns="2" cellpadding="5"> 
                            <h:outputText value="¿Seguro desea cerrar sesión?"/>
                            <br/>              
                            <h:panelGrid columns="2" style="margin-top: 10px; text-align: center">
                                <p:commandButton id="salir" value="Aceptar" ajax="false" action="#{userLoginView.logout}" oncomplete="PF('dlgSalir').clear();"/>
                            </h:panelGrid>              
                        </h:panelGrid>
                    </p:dialog>
                </h:form> 
            </p:layoutUnit>   
            <p:layoutUnit position="east" size="150">
                <script type="text/javascript"><!--
                    google_ad_client = "ca-pub-8505972930632681";
                    /* derecha */
                    google_ad_slot = "4293668850";
                    google_ad_width = 300;
                    google_ad_height = 300;
                    //-->
                </script>
                <script type="text/javascript"
                        src="//pagead2.googlesyndication.com/pagead/show_ads.js">
                </script>  
                <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
                <script type="text/javascript"><!--
                    google_ad_client = "ca-pub-8505972930632681";
                    /* Pie */
                    google_ad_slot = "8863469251";
                    google_ad_width = 300;
                    google_ad_height = 300;
                    //-->
                </script>
                <script type="text/javascript"
                        src="//pagead2.googlesyndication.com/pagead/show_ads.js">
                </script>
                <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>
                <script type="text/javascript"><!--
                    google_ad_client = "ca-pub-8505972930632681";
                    /* Pie2 */
                    google_ad_slot = "5770402054";
                    google_ad_width = 300;
                    google_ad_height = 250;
                    //-->
                </script>
                <script type="text/javascript"
                        src="//pagead2.googlesyndication.com/pagead/show_ads.js">
                </script>
            </p:layoutUnit>
        </p:layout>       
    </h:body>   
</html>
